var gulp = require('gulp'),
    concat = require('gulp-concat')
    rename = require('gulp-rename')
    uglify = require('gulp-uglify')
    version = require('./package.json').version
    cssmin = require('gulp-minify-css');
    
gulp.task('shadow', function() {
    return gulp.src('public/lib/develop/*.js')
        .pipe(concat('shadow-' + version + '.js'))    //合并所有js
        .pipe(gulp.dest('public/lib'))    //输出
        .pipe(rename({suffix: '.min'}))   //rename压缩后的文件名
        .pipe(uglify())                   //压缩
        .pipe(gulp.dest('public/lib'));   //输出
});

gulp.task('default', function() {
    return gulp.src('public/lib/www/*.js')
        .pipe(concat('www-' + version + '.js'))    //合并所有js
        .pipe(gulp.dest('public/lib'))    //输出
        .pipe(rename({suffix: '.min'}))   //rename压缩后的文件名
        .pipe(uglify())                   //压缩
        .pipe(gulp.dest('public/lib'));   //输出
});

gulp.task('watch', function(){
    gulp.watch('public/lib/develop/*.js', ['default']);
});
